﻿// JavaScript Document
$(document).ready(function(){
	 $.get("/u/flash?time=" + Math.random(), function(data){
 	 $("#flash_load").html(data);
  });
	 $("#scrollDiv").Scroll({line:1,speed:500,timer:1000});
});


$(function(){
 //搜索框
$("#searchWords").val("请输入关键字").focus(function(){ 
	if($(this).val() == "请输入关键字"){
		$(this).val("");
	}
}).blur(function(){
	if($(this).val() == ""){
		$(this).val("请输入关键字");
	}
});


//弹出菜单样式
$(".akimi_topcenter_gc li").hover(
  function() {
	var i = $(".akimi_topcenter_gc li").index(this);
	if (i!=0)
	{
		$(this).css({"background":"#55A01E","cursor":"pointer","color":"#FFFFFF"});
		var x =(document.body.clientWidth/2);
		$(".akimi_nva_gc").css({"left": + (x- 228) + "px"});
//		$("#menu_"+i).slideDown("slow");
		$("#menu_"+i).show();
	}
  },
  function(){
	var i = $(".akimi_topcenter_gc li").index(this);
	if (i!=0)
	{
		$(this).css({"background":"#FFFFFF","color":"#000000"});
//		$("#menu_"+i).slideUp(100);
		$("#menu_"+i).hide();
	}
});


$(".akimi_nva_gc span").hover(
  function () {
	$(this).addClass("hover_nav_gc");
  },
  function(){
   $(this).removeClass("hover_nav_gc");
});


//购物车样式
var slideCartTime;
$('#cartId').hover(
function(){
	$(this).attr('class','cartOn_gc');
	$(this).css({"background":"url(//i.akimimi.com/t/default_zh_cn/image/shopping_img1.jpg) no-repeat 8px center","background-color":"#62B326","cursor":"pointer","text-align":"center"});
	$("#cartId A").css({"text-decoration":"none","color":"#FFFFFF"});
	$('#cartGoods_gc').show();
	if(slideCartTime != null) clearTimeout(slideCartTime);
},
function(){
	$(this).css('myCart_gc');
	$(this).addClass("cartOut_gc");
	$(this).css({"background":"url(//i.akimimi.com/t/default_zh_cn/image/shopping_img.gif) no-repeat 8px center","background-color":"#FFF","text-align":"center"});
	$("#cartId A").css({"text-decoration":"none","color":"#76A73A"});
	$('#cartGoods_gc').hide();
});

//我的阿基米米
$('#aKimimi').hover(
function(){
	$(this).attr('class','akimimiOn_gc');
	$(this).css({"background":"url(//i.akimimi.com/t/default_zh_cn/image/my_img1.jpg) no-repeat 8px center","background-color":"#62B326","cursor":"pointer","text-align":"center"});
	$("#aKimimi A").css({"text-decoration":"none","color":"#FFFFFF"});
	$('#myMimi_gc').show();
},
function(){
	$(this).css({"background":"url(//i.akimimi.com/t/default_zh_cn/image/my_img.gif) no-repeat 8px center","background-color":"#FFF","text-align":"center"});
	$("#aKimimi A").css({"text-decoration":"none","color":"#76A73A"});
	$('#myMimi_gc').hide();
});

//我的阿基米米下拉菜单鼠标经过样式
$('#myMimi_gc li').hover(
function(){
	$(this).css({"background":"#55A01E","cursor":"pointer","color":"#FFFFFF"});
},
function(){
	$(this).css({"background":"#FFFFFF","color":"#444444"});
});

//了解boy
$('.r_kf a').hover(
function(){
	$(this).css({"background":"#74DF42","cursor":"pointer","color":"#FFFFFF"});
},
function(){
	$(this).css({"background":"#FFFFFF","color":"#999999"});
});

//商品分类鼠标经过样式
$('.pClassList_gc span:not(.seperator)').hover(
function(){
	$(this).addClass("classhover_gc");
},
function(){
	$(this).removeClass("classhover_gc");
});

//商品分类鼠标经过样式
$('#class_border span:not(.seperator)').hover(
function(){
	$(this).addClass("classhover");
},
function(){
	$(this).removeClass("classhover");
});

//鼠标经过商品样式
$('.pro_list img').hover(
function(){
	$(this).css({"border":"solid #55A01E 1px","cursor":"pointer"});
},
function(){
	$(this).css({"border":"solid #E5E5E5 1px"});
});

//鼠标经过促销商品图片
$('.cu_list img').hover(
function(){
	$(this).css({"border":"solid #55A01E 1px","cursor":"pointer"});
},
function(){
	$(this).css({"border":"solid #E5E5E5 1px"});
});


//促销频道
$(".cu_top li").click(function(){
	var i = ($(".cu_top li").index(this))+1;
	var detail ="#cu_1,#cu_2,#cu_3";
	$(this).attr("class","title_2").siblings().attr("class","title_1");	 
	if(i == 1){
		$("#cu_2").hide();
		$("#cu_3").hide();
	}else if(i == 2){
		$("#cu_1").hide();
		$("#cu_3").hide();
	}else{
		$("#cu_1").hide();
		$("#cu_2").hide();
	}
	$("#cu_" + i).slideDown('1500');
	$(detail).not($("#cu_" + i)).slideUp('1500');
	
});


});

(function($){
$.fn.extend({
        Scroll:function(opt,callback){
                //参数初始化
                if(!opt) var opt={};
                var _this=this.eq(0).find("ul:first");
                var        lineH=_this.find("li:first").height(), //获取行高
                        line=opt.line?parseInt(opt.line,10):parseInt(this.height()/lineH,10), //每次滚动的行数，默认为一屏，即父容器高度
                        speed=opt.speed?parseInt(opt.speed,10):500, //卷动速度，数值越大，速度越慢（毫秒）
                        timer=opt.timer?parseInt(opt.timer,10):3000; //滚动的时间间隔（毫秒）
                if(line==0) line=1;
                var upHeight=0-line*lineH;
                //滚动函数
                scrollUp=function(){
                        _this.animate({
                                marginTop:upHeight
                        },speed,function(){
                                for(i=1;i<=line;i++){
                                        _this.find("li:first").appendTo(_this);
                                }
                                _this.css({marginTop:0});
                        });
                }
                //鼠标事件绑定
                _this.hover(function(){
                        clearInterval(timerID);
                },function(){
                        timerID=setInterval("scrollUp()",timer);
                }).mouseout();
        }        
})
})(jQuery);
